import java.util.concurrent.atomic.AtomicInteger;

public class Test {
    static AtomicInteger a = new AtomicInteger(0);
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            for (int i = 0; i < 10000; i++) {
                a.getAndIncrement();//a++
                /**
                 *    a.incrementAndGet();//++a
                 *    a.getAndDecrement();//a--
                 *    a.decrementAndGet();//--a
                 */
            }
        });
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 10000; i++) {
                a.getAndIncrement();
            }
        });
        t.start();
        t1.start();
        t.join();
        t1.join();
        System.out.println(a);
    }
}
